home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 6 / dbf_tc.zip / D_ADDREC.C next >
Text File  |  1987-06-06  |  820b  |  30 lines

  1. /* 
  2. **        file:        d_addrec.c
  3. **        purpose:    routine to append a record to a open dbaseiii file.
  4. **        usage:    d = (struct DBF *)malloc(sizeof(struct DBF));
  5. **                    strcpy(d->filename,"filename.dbf");
  6. **                    d_open(d);
  7. **                    ... put desired data into memory at location pointed to by
  8. **                            d->record_ptr ...
  9. **                    d_addrec(d);
  10. **                    d_close(d);
  11. **                    free(d);
  12. **        notes:    compile with "tcc -c d_addrec".    include this file in dbf.li
  13. **                    see dbf.h for structure of DBF
  14. **        author:    Mark Sadler
  15. **        revised:    6/6/87
  16. */
  17.  
  18. #include <stdio.h>
  19. #include "dbf.h"
  20.  
  21. int d_addrec(struct DBF *d)
  22. {
  23.     fseek(d->file_ptr,((long)d->header_length + (d->records * d->record_length)),0);
  24.     fwrite(d->record_ptr,d->record_length,1,d->file_ptr);
  25.     d->current_record = ++d->records;
  26.     d->status = updated;
  27.     return(0);
  28. }
  29.  
  30.